<template>
  <div class="knife4j-loading-container" v-show="show">
    <div class="knife4j-loading-mask"></div>
    <div class="knife4j-loading-content">
      <div class="knife4j-loading-animate"></div>
      <div class="knife4j-loading-text">{{text}}</div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    show: Boolean,
    text: {
      type: String,
      default: "正在加载中..."
    }
  }
};
</script>
<style lang="less" scoped>
.knife4j-loading-container {
  position: relative;
  text-align: center;
}
.knife4j-loading-mask {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background-color: rgba(124, 124, 124, 0.7);
}
.knife4j-loading-content {
  position: fixed;
  left: 50%;
  top: 45%;
  z-index: 10000;
  transform: translate(-50%, -45%);
  text-align: center;
  color: #fff;

  .knife4j-loading-animate {
    display: inline-block;
    width: 40px;
    height: 40px;
    vertical-align: baseline;
    margin: 25px 0 10px;
    vertical-align: middle;
    animation: cricleLoading 1s steps(12, end) infinite;
    background: transparent
      url("")
      no-repeat;
    background-size: 100%;
  }

  .knife4j-loading-text {
    font-size: 16px;
  }
}

@-webkit-keyframes cricleLoading {
  0% {
    transform: rotate3d(0, 0, 1, 0deg);
  }
  100% {
    transform: rotate3d(0, 0, 1, 360deg);
  }
}
@keyframes cricleLoading {
  0% {
    transform: rotate3d(0, 0, 1, 0deg);
  }
  100% {
    transform: rotate3d(0, 0, 1, 360deg);
  }
}
</style>